<?php

/**
 *  任务模型
 */
class taskModel extends Model
{

    // 项目表名称
    private $table = '`sd_task`';


    function add($data)
    {
        Return $this->_insert($this->table, $data);
    }
    
    function memberall($id)
    {
        Return $this->_all("SELECT * FROM " . $this->table . " WHERE member_id = {$id}");
    }
    
    function memberall2($id,$class)
    {
        Return $this->_all("SELECT * FROM " . $this->table . " WHERE member_id = {$id} and status = {$class}");
    }
    
    function info($id)
    {
        Return $this->_row("SELECT * FROM " . $this->table . " WHERE task_id = '{$id}'" );
    }
    
    function del($id){
        return $this->_query("DELETE FROM" . $this->table . " WHERE task_id = " . $id);
    }
    function update($data,$id)
    {
        $where = "WHERE task_id = ".$id;
        Return $this->_update($this->table, $data, $where);
    }
    function alllist(){
        return $this->_all('SELECT * FROM `sd_task` order by task_id desc');
    }
    function alllist2($id){
        return $this->_all("SELECT * FROM `sd_task` WHERE status = {$id} order by task_id desc");
    }
    function updatestatus($id,$data){
        $where = "WHERE task_id = ".$id;
        Return $this->_update($this->table, $data, $where);
    }
    
    function allsum($id){
        return $this->_sum("SELECT * FROM `sd_task` WHERE member_id = {$id}");
    }
    function allsum2($id){
        return $this->_sum("SELECT * FROM `sd_task` WHERE member_id = {$id} and status = 10");
    }
    function allsum3($id){
        return $this->_sum("SELECT * FROM `sd_task` WHERE member_id = {$id} and status = 11");
    }
    function pai1(){
        return $this->_all('SELECT sd_task.*,sd_member.name FROM `sd_task`,`sd_member` where sd_task.member_id=sd_member.member_id  order by task_id desc limit 7');
    }
    

}  
?>
